package com.example.UserServer.Controller;

import java.util.List;

import com.netflix.client.http.HttpRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.example.UserServer.Entity.User;
import com.example.UserServer.Service.UserServiceInterface;
import javax.servlet.http.HttpServletRequest;

@RestController
@Api(value = "Shop")  
public class UserServerController {
	@Autowired
	UserServiceInterface UserServiceInterface;
	
	
	
	

	
	@GetMapping
	@ApiOperation(value="获取指定id用户详细信息", notes="根据user的id来获取用户详细信息")
    @ApiImplicitParam(name = "id",value = "用户id", dataType = "String", paramType = "path")
	@RequestMapping(value = "/user/{id}", method = RequestMethod.GET)
	public User FindUserById(@PathVariable String id , HttpServletRequest request)
	{
		System.out.println("我在被调用了请注意了"+request.getLocalPort());
		int Userid= request.getLocalPort();
		return UserServiceInterface.FindUserById(Userid);
		  
	}

}
